<?php //pack11class

class ObjectCardPrintable extends Module {

    public function setup() {
        $object=ObjectsManager::getCurrentObject();
        $currency = SettingsManager::getSetting("currency");

        $item=new SimpleModule();
        $item->setBody("<h3><b>".$object->label."<br/></h3>");
        $this->addChild($item);

        $item=new SimpleModule();
        $item->setBody(str_replace(array("\r\n", "\r", "\n"), '<br />', $object->description[LanguagesManager::current()]));
        $this->addChild($item);

        $item=new SimpleModule();
        $item->setBody("<h1>".$object->getMoney(false)."</h1>");
        $this->addChild($item);

        $item=new SimpleModule();
        $item->addStyle("page-break-after","always");
        $item->setBody("<h3>".$object->getMoney(true)."</h3>");
        $this->addChild($item);

        $item=new SimpleModule();
        $photos="";
        $hack='<script language="javascript" type="text/javascript">';
        $images=$object->getPhotos();
        usort($images, array("AdminObject","sortPhotos"));
        foreach($images as $image) {
            $hack.=str_replace('\"','"',"operahack = new Image ();
            operahack.src = \"photos/original/".$image->value."\";");
            $photo=new SimpleModule();
            $photo->addStyle("page-break-after","always");
            $photo->addStyle("width","100%");
            $photo->setBody(str_replace('\"','"',"<img src=\"photos/original/".$image->value."\" width=\"100%\"/>"));
            $item->addChild($photo);
        }
        $hack.='</script>';
        $item->addHTML($hack);
        $this->addChild($item);

    }

}
?>
